﻿// QuocPT
 
package XFComponent
{	
	import flash.text.TextFieldAutoSize;

	public class XFLabelButton extends XFImageButton
	{
		protected var xfLabel : XFLabel;		
		
		public function XFLabelButton() : void
		{
			super();
			
			xfLabel					=	new XFLabel();
			xfLabel.mouseChildren	=	false;
			xfLabel.mouseEnabled	=	false;
			xfLabel.textField.autoSize	=	TextFieldAutoSize.LEFT;
			
			addChild( xfLabel );		
		}
		
		public function get labelPtr() : XFLabel
		{
			return xfLabel;
		}
		
		public function set title( content : String ) : void
		{
			xfLabel.text	=	content;
			invalidateTitle();
		}
		
		public function get title() : String
		{
			return xfLabel.text;
		}
		
		public function invalidateTitle() : void
		{
			xfLabel.x		=	-xfLabel.width * 0.5;
		}
	}
}